package com.atguigu.spzx.service.handler;

import com.atguigu.spzx.model.vo.common.Result;
import com.atguigu.spzx.service.exception.GuiguException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author wx
 * @version 1.0
 * @description: TODO
 * @date 2024/11/6 14:15
 */
@RestControllerAdvice
public class GlobalExceptionHandler {
    @ExceptionHandler(Exception.class)
    public Result error(Exception e) {
        e.printStackTrace();
        return Result.build(null, 201, e.getMessage());
    }


    @ExceptionHandler(GuiguException.class)
    public Result error(GuiguException e) {
        e.printStackTrace();
        return Result.build(null, 201, e.getMessage());
    }
}
